/**
 * 版本信息
 */
define([
    '../../../app/framework/bean/version',
    '../../../app/framework/bean/user'
], function(
    versionModel,
    userModel
) {
    var version = {
        init: function() {
                var _this = this;
                _this.loadVersionData();
            }
            /*
            	@获取版本信息数据
            */
            ,
        loadVersionData: function() {
            var _this = this;
            var _versionArea = $('#version-area'),
                _tmpHtml = '';
            userModel.queryUser(function(user) {
                var params = {
                    language: user.language
                }
                versionModel.getVersionInfoList(params, function(result) {
                    $.each(result, function(i, v) {
                        if (i == 0) {
                            _tmpHtml += '<h3>' + I18N.getText('index', 'currentVersion') ;
                        } else {
                            _tmpHtml += '<h3>' + I18N.getText('index', 'historyVersion') ;
                        }
                        _tmpHtml += v.version + '</h3>' + '<ul>';
                        _tmpHtml += '<li>' + v.body + '</li>';
                        _tmpHtml += '</ul>';
                    });
                    _versionArea.html(_tmpHtml);
                });
            })
        }
    }
    return version;
});
